import sys
import os

sys.path.append(os.getcwd())
import runtest

def python_file(name):
    return ('%s/%s' % (runtest.options.workdir, name)).replace('/', '\\')

tests = []
#exception
tests.append(runtest.result_test({}, {"exit_staus":"FINISHED_ABNORMALLY"},
    arguments=python_file('exception.py'),
    test_name="exception"))
#filez
tests.append(runtest.result_test({"write_limit":"0.3"}, {"terminate_reason":"WRITE_LIMIT"},
    arguments=python_file('simple_file.py'),
    test_name="file"))
tests.append(runtest.result_test({"write_limit":"7"}, {"terminate_reason":"WRITE_LIMIT"},
    arguments=python_file('simple_file.py'),
    test_name="file"))
tests.append(runtest.result_test({"write_limit":"14"}, {"terminate_reason":"WRITE_LIMIT"},
    arguments=python_file('simple_file.py'),
    test_name="file"))
#memory
tests.append(runtest.result_test({"memory_limit":"0.3"}, {"terminate_reason":"MEMORY_LIMIT"},
    arguments=python_file('simple_memory.py'),
    test_name="memory"))
tests.append(runtest.result_test({"memory_limit":"3"}, {"terminate_reason":"MEMORY_LIMIT"},
    arguments=python_file('simple_memory.py'),
    test_name="memory"))
tests.append(runtest.result_test({"memory_limit":"30"}, {"terminate_reason":"MEMORY_LIMIT"},
    arguments=python_file('simple_memory.py'),
    test_name="memory"))
tests.append(runtest.result_test({"memory_limit":"300"}, {"terminate_reason":"MEMORY_LIMIT"},
    arguments=python_file('simple_memory.py'),
    test_name="memory"))
#performance
tests.append(runtest.result_test({"time_limit":"5"}, {"terminate_reason":"TIME_LIMIT"},
    arguments=python_file('for_simple.py 4 10000000'),
    test_name="simple_for"))
tests.append(runtest.result_test({"time_limit":"6"}, {"terminate_reason":"TIME_LIMIT"},
    arguments=python_file('for_simple.py 4 10000000'),
    test_name="simple_for"))
tests.append(runtest.result_test({"time_limit":"7"}, {"terminate_reason":"TIME_LIMIT"},
    arguments=python_file('for_simple.py 4 10000000'),
    test_name="simple_for"))
tests.append(runtest.result_test({"time_limit":"3"}, {"terminate_reason":"TIME_LIMIT"},
    arguments=python_file('for_threaded.py 4 10000000'),
    test_name="simple_threaded"))
tests.append(runtest.result_test({"time_limit":"4"}, {"terminate_reason":"TIME_LIMIT"},
    arguments=python_file('for_threaded.py 4 10000000'),
    test_name="simple_threaded"))

runtest.use_tests(runtest.Tests(tests))
